import random, es, gamethread, effectlib

colors = ((255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 255, 0), (255, 0, 255), (0, 255, 255)) 


rletters = {
	"!":['0, 0, 0, 0, 0, 3', '0, 0, 6, 0, 0, 30'],
	"#":['7, 0, 0, 7, 0, 30', '14, 0, 0, 14, 0, 30', '0, 0, 10, 20, 0, 10', '0, 0, 20, 20, 0, 20'],
	'"':['9, 0, 26, 9, 0, 30', '11, 0, 26, 11, 0, 30'],
	"%":['5, 0, 20, 0, 0, 25', '15, 0, 0, 10, 0, 5', '0, 0, 0, 20, 0, 30', '0, 0, 25, 5, 0, 30', '5, 0, 30, 10, 0, 25', '10, 0, 25, 5, 0, 20', '10, 0, 5, 15, 0, 10', '15, 0, 10, 20, 0, 5', '20, 0, 5, 15, 0, 0'],
	"$":['0, 0, 0, 18, 0, 0', '18, 0, 0, 20, 0, 6', '20, 0, 6, 20, 0, 12', '20, 0, 12, 17, 0, 13', '17, 0, 13, 6, 0, 13', '6, 0, 13, 0, 0, 18', '0, 0, 18, 1, 0, 24', '1, 0, 24, 5, 0, 30', '5, 0, 30, 18, 0, 30', '7, 0, -5, 7, 0, 35', '14, 0, -5, 14, 0, 35'],
	"'":['10, 0, 26, 10, 0, 30'],
	"&":['8.5, 0, 30, 8.5, 0, 37', '8.5, 0, 0, 8.5, 0, -7', '0, 0, 4, 4, 0, 0', '4, 0, 0, 13, 0, 0', '13, 0, 0, 15, 0, 7', '0, 0, 15, 15, 0, 15', '0, 0, 3, 0, 0, 25', '17, 0, 20, 17, 0, 27', '17, 0, 27, 15, 0, 30', '15, 0, 30, 4, 0, 30', '4, 0, 30, 0, 0, 25'],
	")":['0, 0, 30, 6, 0, 27', '6, 0, 27, 9, 0, 24', '9, 0, 24, 12, 0, 21', '12, 0, 21, 13.5, 0, 18', '13.5, 0, 18, 13.5, 0, 15', '13.5, 0, 15, 12, 0, 9', '12, 0, 9, 9, 0, 3', '9, 0, 3, 6, 0, 1.5', '6, 0, 1.5, 3, 0, 0', '3, 0, 0, 0, 0, 0'],
	"(":['16, 0, 0, 8, 0, 2', '8, 0, 2, 0, 0, 6', '0, 0, 6, -2, 0, 12', '-2, 0, 12, -2, 0, 20', '-2, 0, 20, 1, 0, 28', '1, 0, 28, 6, 0, 30', '6, 0, 30, 16, 0, 32'],
	"+":['0, 0, 15, 20, 0, 15', '10, 0, 0, 10, 0, 30'],
	"*":['10, 0, 15, 10, 0, 30', '0, 0, 25, 20, 0, 25', '0, 0, 15, 20, 0, 30', '20, 0, 15, 0, 0, 30'],
	"-":['0, 0, 15, 20, 0, 15'],
	",":['0, 0, -2, 3, 0, 2'],
	"/":['0, 0, 0, 15, 0, 30'],
	".":['0, 0, 0, 3, 0, 0'],
	"1":['4, 0, 0, 4, 0, 30', '4, 0, 30, 0, 0, 26', '0, 0, 0, 8, 0, 0'],
	"0":['0, 0, 5, 0, 0, 25', '0, 0, 25, 5, 0, 30', '5, 0, 30, 15, 0, 30', '15, 0, 30, 20, 0, 25', '20, 0, 25, 20, 0, 5', '20, 0, 5, 15, 0, 0', '15, 0, 0, 5, 0, 0', '5, 0, 0, 0, 0, 5'],
	"3":['0, 0, 4, 4, 0, 0', '4, 0, 0, 13, 0, 0', '13, 0, 0, 15, 0, 7', '0, 0, 15, 15, 0, 15', '15, 0, 5, 17, 0, 20', '17, 0, 20, 17, 0, 27', '17, 0, 27, 15, 0, 30', '15, 0, 30, 4, 0, 30', '4, 0, 30, 0, 0, 25'],
	"2":['20, 0, 0, 0, 0, 0', '0, 0, 0, 15, 0, 10', '15, 0, 10, 17, 0, 20', '17, 0, 20, 17, 0, 27', '17, 0, 27, 10, 0, 28', '17, 0, 27, 10, 0, 30', '10, 0, 30, 0, 0, 30', '0, 0, 30, 0, 0, 27'],
	"5":['0, 0, 5, 0, 0, 3', '0, 0, 3, 5, 0, 0', '5, 0, 0, 12, 0, 0', '12, 0, 0, 15, 0, 5', '15, 0, 15, 0, 0, 15', '0, 0, 15, 0, 0, 30', '0, 0, 30, 15, 0, 30', '15, 0, 15, 15, 0, 0'],
	"4":['15, 0, 0, 15, 0, 30', '0, 0, 15, 0, 0, 30', '0, 0, 15, 20, 0, 15'],
	"7":['0, 0, 30, 13, 0, 30', '0, 0, 0, 13, 0, 30'],
	"6":['10, 0, 30, 0, 0, 25', '0, 0, 25, 0, 0, 5', '0, 0, 5, 3, 0, 0', '3, 0, 0, 10, 0, 0', '10, 0, 0, 15, 0, 5', '15, 0, 5, 15, 0, 10', '15, 0, 10, 10, 0, 12', '10, 0, 12, 5, 0, 12', '5, 0, 12, 0, 0, 10'],
	"9":['15, 0, 0, 15, 0, 30', '15, 0, 30, 5, 0, 30', '5, 0, 30, 0, 0, 25', '0, 0, 25, 0, 0, 20', '0, 0, 20, 5, 0, 15', '5, 0, 15, 10, 0, 15', '10, 0, 15, 15, 0, 20'],
	"8":['5, 0, 30, 10, 0, 30', '10, 0, 30, 15, 0, 25', '15, 0, 25, 10, 0, 20', '10, 0, 20, 5, 0, 15', '5, 0, 15, 0, 0, 20', '0, 0, 20, 0, 0, 25', '0, 0, 25, 5, 0, 30', '10, 0, 15, 15, 0, 10', '15, 0, 10, 15, 0, 5', '15, 0, 5, 10, 0, 0', '10, 0, 0, 5, 0, 0', '5, 0, 0, 0, 0, 5', '0, 0, 5, 0, 0, 10', '0, 0, 10, 5, 0, 15'],
	";":['10, 0, 30, 10, 0, 28', '10, 0, 5, 8, 0, 0'],
	":":['0, 0, 0, 0, 0, 3', '0, 0, 27, 0, 0, 30'],
	"=":['0, 0, 10, 20, 0, 10', '0, 0, 20, 20, 0, 20'],
	"<":['20, 0, 30, 0, 0, 15', '20, 0, 0, 0, 0, 15'],
	"?":['0, 0, 20, 0, 0, 25', '0, 0, 25, 5, 0, 30', '5, 0, 30, 10, 0, 30', '10, 0, 30, 15, 0, 25', '15, 0, 25, 15, 0, 15', '15, 0, 15, 10, 0, 10', '10, 0, 10, 5, 0, 10', '5, 0, 10, 5, 0, 5', '5, 0, 1, 5, 0, -1'],
	">":['0, 0, 30, 20, 0, 15', '0, 0, 0, 20, 0, 15'],
	"@":['16, 0, 0, 8, 0, 2', '8, 0, 2, 0, 0, 6', '0, 0, 6, -2, 0, 12', '-2, 0, 12, -2, 0, 20', '-2, 0, 20, 1, 0, 28', '1, 0, 28, 6, 0, 30', '6, 0, 30, 16, 0, 32', '16, 0, 30, 22, 0, 27', '22, 0, 27, 25, 0, 24', '25, 0, 24, 28, 0, 21', '28, 0, 21, 29.5, 0, 18', '29.5, 0, 18, 29.5, 0, 15', '29.5, 0, 15, 28, 0, 9', '28, 0, 9, 25, 0, 3', '25, 0, 3, 22, 0, 1.5', '22, 0, 1.5, 19, 0, 0', '19, 0, 0, 0, 0, 0', '30, 0, 15, 20, 0, 15', '20, 0, 15, 5, 0, 10', '5, 0, 10, 5, 0, 0'],
	"[":['0, 0, 0, 0, 0, 30', '0, 0, 30, 7, 0, 30', '0, 0, 0, 7, 0, 0'],
	"]":['7, 0, 0, 7, 0, 30', '0, 0, 0, 7, 0, 0', '0, 0, 30, 7, 0, 30'],
	"\\":['15, 0, 0, 0, 0, 30'],
	"_":['0, 0, 0, 20, 0, 0'],
	"^":['0, 0, 15, 10, 0, 30', '20, 0, 15, 10, 0, 30'],
	"a":['0, 0, 0, 10, 0, 30', '20, 0, 0, 10, 0, 30', '5, 0, 15,15, 0, 15'],
	"`":['0, 0, 30, 4, 0, 26'],
	"c":['16, 0, 0, 8, 0, 2', '8, 0, 2, 0, 0, 6', '0, 0, 6, -2, 0, 12', '-2, 0, 12, -2, 0, 20', '-2, 0, 20, 1, 0, 28', '1, 0, 28, 6, 0, 30', '6, 0, 30, 16, 0, 32'],
	"b":['0, 0, 0, 0, 0, 30', '0, 0, 30, 10, 0, 25', '10, 0, 25, 12, 0, 20', '12, 0, 20, 12, 0, 17.5', '12, 0, 17.5, 10, 0, 15', '10, 0, 15, 0, 0, 15', '0, 0, 15, 15, 0, 15', '5, 0, 15, 10, 0, 12.5', '10, 0, 12.5, 12.5, 0, 9', '12.5, 0, 9, 12.5, 0, 5', '12.5, 0, 5, 10, 0, 2.5', '10, 0, 2.5, 8, 0, 0', '10, 0, 2.5, 0, 0, 0'],
	"e":['0, 0, 0, 0, 0, 30', '0, 0, 30, 15, 0, 30', '0, 0, 15, 15, 0, 15', '0, 0, 0, 15, 0, 0'],
	"d":['0, 0, 30, 6, 0, 27', '6, 0, 27, 9, 0, 24', '9, 0, 24, 12, 0, 21', '12, 0, 21, 13.5, 0, 18', '13.5, 0, 18, 13.5, 0, 15', '13.5, 0, 15, 12, 0, 9', '12, 0, 9, 9, 0, 3', '9, 0, 3, 6, 0, 1.5', '6, 0, 1.5, 3, 0, 0', '3, 0, 0, 0, 0, 0', '0, 0, 0, 0, 0, 30'],
	"g":['16, 0, 0, 8, 0, 2', '8, 0, 2, 0, 0, 6', '0, 0, 6, -2, 0, 12', '-2, 0, 12, -2, 0, 20', '-2, 0, 20, 1, 0, 28', '1, 0, 28, 6, 0, 30', '6, 0, 30, 16, 0, 32', '16, 0, 0, 18, 0, 4', '18, 0, 4, 19, 0, 8', '19, 0, 8, 16, 0, 10', '16, 0, 10, 8, 0, 10'],
	"f":['0, 0, 0, 0, 0, 30', '0, 0, 30, 15, 0, 30', '0, 0, 15, 15, 0, 15'],
	"i":['7.5, 0, 0, 7.5, 0, 30', '0, 0, 30, 15, 0, 30', '0, 0, 0, 15, 0, 0'],
	"h":['0, 0, 0, 0, 0, 30', '15, 0, 0, 15, 0, 30', '0, 0, 15, 15, 0, 15'],
	"k":['0, 0, 0, 0, 0, 30', '0, 0, 15, 15, 0, 30', '0, 0, 15, 15, 0, 0'],
	"j":['0, 0, 30, 20, 0, 30', '10, 0, 30, 10, 0, 10', '10, 0, 10, 8, 0, 5', '8, 0, 5, 7, 0, 0', '7, 0, 2, 6, 0, 0', '4, 0, 0, -2, 0, 10'],
	"m":['0, 0, 0, 5, 0, 30', '5, 0, 30, 10, 0, 0', '10, 0, 0, 15, 0, 30', '15, 0, 30, 20, 0, 0'],
	"l":['0, 0, 0, 0, 0, 30', '0, 0, 0, 15, 0, 0'],
	"o":['16, 0, 0, 8, 0, 2', '8, 0, 2, 0, 0, 6', '0, 0, 6, -2, 0, 12', '-2, 0, 12, -2, 0, 20', '-2, 0, 20, 1, 0, 28', '1, 0, 28, 6, 0, 30', '6, 0, 30, 16, 0, 32', '16, 0, 30, 22, 0, 27', '22, 0, 27, 25, 0, 24', '25, 0, 24, 28, 0, 21', '28, 0, 21, 29.5, 0, 18', '29.5, 0, 18, 29.5, 0, 15', '29.5, 0, 15, 28, 0, 9', '28, 0, 9, 25, 0, 3', '25, 0, 3, 22, 0, 1.5', '22, 0, 1.5, 19, 0, 0', '19, 0, 0, 0, 0, 0'],
	"n":['0, 0, 0, 5, 0, 30', '5, 0, 30, 10, 0, 0', '10, 0, 0, 15, 0, 30'],
	"q":['16, 0, 0, 8, 0, 2', '8, 0, 2, 0, 0, 6', '0, 0, 6, -2, 0, 12', '-2, 0, 12, -2, 0, 20', '-2, 0, 20, 1, 0, 28', '1, 0, 28, 6, 0, 30', '6, 0, 30, 16, 0, 32', '16, 0, 30, 22, 0, 27', '22, 0, 27, 25, 0, 24', '25, 0, 24, 28, 0, 21', '28, 0, 21, 29.5, 0, 18', '29.5, 0, 18, 29.5, 0, 15', '29.5, 0, 15, 28, 0, 9', '28, 0, 9, 25, 0, 3', '25, 0, 3, 22, 0, 1.5', '22, 0, 1.5, 19, 0, 0', '19, 0, 0, 0, 0, 0', '10, 0, 4, 15, 0, -8'],
	"p":['0, 0, 0, 0, 0, 30', '0, 0, 30, 10, 0, 25', '10, 0, 25, 12, 0, 20', '12, 0, 20, 12, 0, 17.5', '12, 0, 17.5, 10, 0, 15', '10, 0, 15, 0, 0, 15'],
	"s":['0, 0, 0, 18, 0, 0', '18, 0, 0, 20, 0, 6', '20, 0, 6, 20, 0, 12', '20, 0, 12, 17, 0, 13', '17, 0, 13, 6, 0, 13', '6, 0, 13, 0, 0, 18', '0, 0, 18, 1, 0, 24', '1, 0, 24, 5, 0, 30', '5, 0, 30, 18, 0, 30'],
	"r":['0, 0, 0, 0, 0, 30', '0, 0, 30, 10, 0, 25', '10, 0, 25, 12, 0, 20', '12, 0, 20, 12, 0, 17.5', '12, 0, 17.5, 10, 0, 15', '10, 0, 15, 0, 0, 15', '0, 0, 15, 13, 0, 0'],
	"u":['0, 0, 30, 0, 0, 18', '0, 0, 18, 4, 0, 8', '4, 0, 8, 8, 0, 0', '8, 0, 0, 16, 0, 0', '16, 0, 0, 20, 0, 8', '20, 0, 8, 20, 0, 16', '20, 0, 16, 20, 0, 30'],
	"t":['10, 0, 0, 10, 0, 30', '0, 0, 30, 20, 0, 30'],
	"w":['0, 0, 30, 5, 0, 0', '5, 0, 0, 10, 0, 30', '10, 0, 30, 15, 0, 0', '15, 0, 0, 20, 0, 30'],
	"v":['0, 0, 30, 10, 0, 0', '10, 0, 0, 20, 0, 30'],
	"y":['0, 0, 30, 10, 0, 20', '20, 0, 30, 10, 0, 20', '10, 0, 20, 10, 0, 0'],
	"x":['0, 0, 0, 20, 0, 30', '20, 0, 0, 0, 0, 30'],
	"z":['0, 0, 30, 20, 0, 30', '20, 0, 30, 0, 0, 0', '0, 0, 0, 20, 0, 0'],
	"|":['10, 0, 0, 10, 0, 30'],
	"~":['0, 0, 15, 5, 0, 20', '5, 0, 20, 10, 0, 10', '10, 0, 10, 15, 0, 20', '15, 0, 20, 20, 0, 10']
}


def load():
	if not es.exists('saycommand', '!ll'):
		es.regsaycmd('!ll', 'prop/make_letters', 'Make a letter or word above your head!')

def unload():
	if es.exists('saycommand', '!ll'):
		es.unregsaycmd('!ll')

class letters: 
	def __init__(self, letter): 
		self.letter = letter 
		
	def create(self, *args): 
		if len(args) == 7: 
			self.RunEffect(args) 
			
	def RunEffect(self, client): 
		for adjust in rletters[self.letter]: 
			adjust = adjust.split(",") 
			effectlib.drawLine([client[0] + float(adjust[0]), client[1] + float(adjust[1]), client[2] + float(adjust[2])], [client[0] + float(adjust[3]), client[1] + float(adjust[4]), client[2] + float(adjust[5])], "materials/sprites/laser.vmt", "materials/sprites/halo01.vmt", 30, 5, 5, client[4], client[5], client[6], 255, 10, 0, 0, 0, 0)

def make_letters():
	userid = es.getcmduserid()
	loc = es.getplayerlocation(userid) 
	command1 = es.getargs().lower()
	a = 0
	b = 1
	while a < len(command):
		color = random.choice(colors)
		if command[a] == 'o' or command[a] == 'q':
			gamethread.delayed(b / 200.0, letters(command[a]).create, args=(loc[0] + b + 8, loc[1], loc[2] + 100, 45, color[0], color[1], color[2]))
			b += 25
		elif command[a] == 'm':
			gamethread.delayed(b / 200.0, letters(command[a]).create, args=(loc[0] + b, loc[1], loc[2] + 100, 45, color[0], color[1], color[2]))
			b += 5
		elif command[a] != " ":
			gamethread.delayed(b / 200.0, letters(command[a]).create, args=(loc[0] + b, loc[1], loc[2] + 100, 45, color[0], color[1], color[2]))
		a += 1
		b += 20